package cn.yjh;

// -javaagent:D:\workspace\monitor-system\monitor-bootstrap\target\monitor-bootstrap\monitor-bootstrap\monitor-bootstrap.jar

import org.openjdk.jol.info.ClassLayout;

import java.util.concurrent.TimeUnit;

/**
 * @DESC:
 * @AUTHOR: YouJinhua
 * @DATE: 2021-11-18 22:03:35
 * @VERSION: 1.0
 */
public class Demo extends Object {

    static class T{
        int a =1;
    }

    static class X{
        int a =1;
    }

    public static void main(String[] args) throws Exception {
        String str = new String();
        T[] t = new T[10];
        X[] t1 = new X[10];
        System.out.println(ClassLayout.parseInstance(t).toPrintable());
        System.out.println(ClassLayout.parseInstance(t1).toPrintable());
        System.out.println(ClassLayout.parseInstance(str).toPrintable());

        int year = 100;
        for(int i=1;i<=year;i++){
            System.out.println("第："+i+" 年 = "+getNum(i)+" 只羊");
        }
        /*while (true){
            TimeUnit.SECONDS.sleep(10);
            System.out.println("demo......");
        }*/
    }

    public static int getNum(int year) {
        int count = 1;
        for (int i = 0; i <= 5 && year>=0; i++,year--) {
            if ( i == 2 || i == 4) {
                count += getNum(year);
            }
            if (i == 5){
                count --;
            }
        }
        return count;
    }
}
